package com.bang.concurrency.example.immutable;

import com.bang.concurrency.annotations.NotThreadSafe;
import com.bang.concurrency.annotations.ThreadSafe;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
import java.util.Map;

/**
 * @Auther: Bang
 * @Date: 2019/9/30 22:32
 * @Description:
 */
@Slf4j
@ThreadSafe
public class ImmutableExample3 {

    private static final ImmutableList<Integer> list = ImmutableList.of(1, 2, 3, 4);

    private static final ImmutableSet<Integer> set = ImmutableSet.of(1, 2, 3, 4, 4);

    private static final ImmutableMap<Integer, Integer> map = ImmutableMap.of(1, 1, 2, 2);

    private static final ImmutableMap<Integer, Integer> map2 = ImmutableMap.<Integer, Integer>builder().
            put(1, 2).put(3, 4).put(5, 6).build();


    public static void main(String[] args) {
        System.out.println(map2.get(3));
    }
}
